package fr.mbds.first.wallet.Activity;

import java.util.Date;
import java.util.LinkedList;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.TextView;
import fr.mbds.first.wallet.R;
import fr.mbds.first.wallet.entity.Operation;
import fr.mbds.first.wallet.entity.OperationAdapter;

public class HistoryActivity extends Activity  {
	List<Operation> listeOperations;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_history);
		
		String solde = getSolde();
		TextView textSolde = (TextView) findViewById(R.id.TextView_History_Balance);
		textSolde.setText(solde); 
	
		listeOperations = getOperation();
		ListView listViewOperations = (ListView) findViewById(R.id.ListView_History_Operations);
		
		OperationAdapter adapter = new OperationAdapter(this, listeOperations);
		listViewOperations.setAdapter(adapter);
	}

	private String getSolde(){
		return "123.02";
	}
	
	private List<Operation> getOperation(){
		LinkedList<Operation> liste = new LinkedList<Operation>();
		
		liste.add(new Operation(500, new Date(),"First Operation"));
		liste.add(new Operation(-230, new Date(),"Second Operation"));
		liste.add(new Operation(400.5, new Date(),"Third Operation"));
		liste.add(new Operation(500, new Date(),"First Operation"));
		liste.add(new Operation(-230, new Date(),"Second Operation"));
		liste.add(new Operation(400.5, new Date(),"Third Operation"));
		liste.add(new Operation(500, new Date(),"First Operation"));
		liste.add(new Operation(-230, new Date(),"Second Operation"));
		liste.add(new Operation(400.5, new Date(),"Third Operation"));
		liste.add(new Operation(500, new Date(),"First Operation"));
		liste.add(new Operation(-230, new Date(),"Second Operation"));
		liste.add(new Operation(400.5, new Date(),"Third Operation"));
		liste.add(new Operation(500, new Date(),"First Operation"));
		liste.add(new Operation(-230, new Date(),"Second Operation"));
		liste.add(new Operation(400.5, new Date(),"Third Operation"));
		liste.add(new Operation(500, new Date(),"First Operation"));
		liste.add(new Operation(-230, new Date(),"Second Operation"));
		liste.add(new Operation(400.5, new Date(),"Third Operation"));
		liste.add(new Operation(500, new Date(),"First Operation"));
		liste.add(new Operation(-230, new Date(),"Second Operation"));
		liste.add(new Operation(400.5, new Date(),"Third Operation"));
		liste.add(new Operation(500, new Date(),"First Operation"));
		liste.add(new Operation(-230, new Date(),"Second Operation"));
		liste.add(new Operation(400.5, new Date(),"Third Operation"));
		liste.add(new Operation(500, new Date(),"First Operation"));
		liste.add(new Operation(-230, new Date(),"Second Operation"));
		liste.add(new Operation(400.5, new Date(),"Third Operation"));
		liste.add(new Operation(500, new Date(),"First Operation"));
		liste.add(new Operation(-230, new Date(),"Second Operation"));
		liste.add(new Operation(400.5, new Date(),"Third Operation"));
		liste.add(new Operation(500, new Date(),"First Operation"));
		liste.add(new Operation(-230, new Date(),"Second Operation"));
		liste.add(new Operation(400.5, new Date(),"Third Operation"));
		liste.add(new Operation(500, new Date(),"First Operation"));
		liste.add(new Operation(-230, new Date(),"Second Operation"));
		liste.add(new Operation(400.5, new Date(),"Third Operation"));
		
		return liste;
		
	}
}
